package pikes.peak;

import java.util.List;

import pikes.html.xhtml.Block;
import pikes.html.xhtml.Inline;
import pikes.html.xhtml.heading.H1;
import pikes.html.xhtml.heading.H2;
import pikes.html.xhtml.heading.H3;
import pikes.html.xhtml.heading.H4;
import pikes.html.xhtml.text.Paragraph;

public interface TextGroupStyle {

	Block apply(Inline inline);

	Block apply(List<Inline> inlines);

	Block apply(List<Inline> inlines, CharSequence clazz);

	TextGroupStyle LEVEL_1 = new TextGroupStyle() {

		public Block apply(Inline inline) {
			return new H1(inline);
		}

		public Block apply(List<Inline> inlines) {
			return new H1(inlines);
		}

		public Block apply(List<Inline> inlines, CharSequence clazz) {
			H1 h1 = new H1(inlines);
			h1.setClazz(clazz);
			return h1;
		}

	};

	TextGroupStyle LEVEL_2 = new TextGroupStyle() {

		public Block apply(Inline inline) {
			return new H2(inline);
		}

		public Block apply(List<Inline> inlines) {
			return new H2(inlines);
		}

		public Block apply(List<Inline> inlines, CharSequence clazz) {
			H2 h2 = new H2(inlines);
			h2.setClazz(clazz);
			return h2;
		}

	};

	TextGroupStyle LEVEL_3 = new TextGroupStyle() {

		public Block apply(Inline inline) {
			return new H3(inline);
		}

		public Block apply(List<Inline> inlines) {
			return new H3(inlines);
		}

		public Block apply(List<Inline> inlines, CharSequence clazz) {
			H3 h3 = new H3(inlines);
			h3.setClazz(clazz);
			return h3;
		}

	};

	TextGroupStyle LEVEL_4 = new TextGroupStyle() {

		public Block apply(Inline inline) {
			return new H4(inline);
		}

		public Block apply(List<Inline> inlines) {
			return new H4(inlines);
		}

		public Block apply(List<Inline> inlines, CharSequence clazz) {
			H4 h4 = new H4(inlines);
			h4.setClazz(clazz);
			return h4;
		}

	};

	TextGroupStyle PARAGRAPH = new TextGroupStyle() {

		public Block apply(Inline inline) {
			return new Paragraph(inline);
		}

		public Block apply(List<Inline> inlines) {
			return new Paragraph(inlines);
		}

		public Block apply(List<Inline> inlines, CharSequence clazz) {
			Paragraph paragraph = new Paragraph(inlines);
			paragraph.setClazz(clazz);
			return paragraph;
		}

	};
}
